//引入createStore，专门用于创建redux中最为核心的store对象
import { createStore } from 'redux'
import {persistStore, persistReducer} from 'redux-persist'
import storage from 'redux-persist/lib/storage'
//引入汇总之后的reducer
import reducers from './reducers'

import loading from '../redux/reducers/loading'

//在localStorge中生成key为root的值
const persistConfig = {
  key: 'root',
  storage,
  blacklist:['loading']
}

const myPersistReducer = persistReducer(persistConfig, reducers)

const store = createStore(myPersistReducer)

const persistor = persistStore(store)

export {
  store,
  persistor
}
